/**
 * 
 */
package com.net.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.net.dao.MetaUtilDao;
import com.net.domain.ClassHourMapping;
import com.net.domain.ClassHours;
import com.net.domain.ClassInfo;
import com.net.domain.Course;
import com.net.domain.CycleTest;
import com.net.domain.Subject;

/**
 * @author Dinesh
 *
 */
public class UtilServiceImpl implements UtilService {
	
	
	private MetaUtilDao metaUtilDao;
	/* (non-Javadoc)
	 * @see com.net.service.UtilService#getAllClass()
	 */
	@Override
	public List<ClassInfo> getAllClass() {
		// TODO Auto-generated method stub
		return metaUtilDao.getAllClass();
	}

	/* (non-Javadoc)
	 * @see com.net.service.UtilService#getAllCourse()
	 */
	@Override
	public List<Course> getAllCourse() {
		// TODO Auto-generated method stub
		return metaUtilDao.getAllCourse();
	}

	/* (non-Javadoc)
	 * @see com.net.service.UtilService#getAllSubject()
	 */
	@Override
	public List<Subject> getAllSubject() {
		// TODO Auto-generated method stub
		return metaUtilDao.getAllSubject();
	}

	/* (non-Javadoc)
	 * @see com.net.service.UtilService#getClass(int)
	 */
	@Override
	public ClassInfo getClass(int classId) {
		// TODO Auto-generated method stub
		return metaUtilDao.getClass(classId);
	}

	/* (non-Javadoc)
	 * @see com.net.service.UtilService#getCourse(int)
	 */
	@Override
	public Course getCourse(int courseId) {
		// TODO Auto-generated method stub
		return metaUtilDao.getCourse(courseId);
	}

	/* (non-Javadoc)
	 * @see com.net.service.UtilService#getSubject(int)
	 */
	@Override
	public Subject getSubject(int subjectId) {
		// TODO Auto-generated method stub
		return metaUtilDao.getSubject(subjectId);
	}
	
	@Override
	public int getClassHourMapId(String classHour, Date date,
			int subjectClassGroupId) {
		
		return metaUtilDao.getClassHourMapId(classHour, date, subjectClassGroupId);
	}
	
	@Autowired
	public void setMetaUtilDao(MetaUtilDao metaUtilDao) {
		this.metaUtilDao = metaUtilDao;
	}

	@Override
	public List<ClassHours> getAllClassHours() {
		// TODO Auto-generated method stub
		return metaUtilDao.getAllClassHours();
	}

	@Override
	public ClassHours getClassHour(int classHourId) {
		// TODO Auto-generated method stub
		return metaUtilDao.getClassHours(classHourId);
	}

	@Override
	public int getClassHourId(String classHour) {
		// TODO Auto-generated method stub
		return 0;
	}
	
	@Override
	public List<ClassHourMapping> getClassByStaff(int staffId) {
		List<ClassHourMapping> classList = metaUtilDao.getClassForStaff(staffId);
		
		for(ClassHourMapping classMap : classList) {
			classMap.setClassInfo(getClass(classMap.getClassId()));
			classMap.setCourse(getCourse(classMap.getCourseId()));
			classMap.setSubject(getSubject(classMap.getSubjectId()));
		}
		return classList;
	}
	@Override
	public List<CycleTest> getAllCycleTest() {
		// TODO Auto-generated method stub
		return metaUtilDao.getAllCycleTest();
	}


}
